/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ec.edu.espe.distribuidas.aseguradora.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author pacodell
 */
@Entity
@Table(name = "poliza", catalog = "distribuidasjsf", schema = "")
@NamedQueries({
    @NamedQuery(name = "Poliza.findAll", query = "SELECT p FROM Poliza p")})
public class Poliza implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NUM_DOCUMENTO")
    private Integer numDocumento;
    @Column(name = "FECHAEXPE")
    @Temporal(TemporalType.DATE)
    private Date fechaexpe;
    @Column(name = "VALIDEZAL")
    @Temporal(TemporalType.DATE)
    private Date validezal;
    @Column(name = "PRIMA")
    private Long prima;
    @JoinColumn(name = "COD_CLIENTE", referencedColumnName = "COD_CLIENTE")
    @ManyToOne
    private Cliente codCliente;
    @JoinColumn(name = "COD_PLAN", referencedColumnName = "COD_PLAN")
    @ManyToOne
    private Plan codPlan;

    public Poliza() {
    }

    public Poliza(Integer numDocumento) {
        this.numDocumento = numDocumento;
    }

    public Integer getNumDocumento() {
        return numDocumento;
    }

    public void setNumDocumento(Integer numDocumento) {
        this.numDocumento = numDocumento;
    }

    public Date getFechaexpe() {
        return fechaexpe;
    }

    public void setFechaexpe(Date fechaexpe) {
        this.fechaexpe = fechaexpe;
    }

    public Date getValidezal() {
        return validezal;
    }

    public void setValidezal(Date validezal) {
        this.validezal = validezal;
    }

    public Long getPrima() {
        return prima;
    }

    public void setPrima(Long prima) {
        this.prima = prima;
    }

    public Cliente getCodCliente() {
        return codCliente;
    }

    public void setCodCliente(Cliente codCliente) {
        this.codCliente = codCliente;
    }

    public Plan getCodPlan() {
        return codPlan;
    }

    public void setCodPlan(Plan codPlan) {
        this.codPlan = codPlan;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numDocumento != null ? numDocumento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Poliza)) {
            return false;
        }
        Poliza other = (Poliza) object;
        if ((this.numDocumento == null && other.numDocumento != null) || (this.numDocumento != null && !this.numDocumento.equals(other.numDocumento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ec.edu.espe.distribuidas.aseguradora.modelo.Poliza[ numDocumento=" + numDocumento + " ]";
    }
    
}
